{{ define "sso/login.html" }}

<!DOCTYPE html>
<html lang="en" class="no-js">

<head>

    <meta charset="utf-8">
    <title>三月登录系统</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- CSS -->
    <link rel='stylesheet' href='http://fonts.googleapis.com/css?family=PT+Sans:400,700'>
    <link rel="stylesheet" href="/static/sso/css/reset.css">
    <link rel="stylesheet" href="/static/sso/css/supersized.css">
    <link rel="stylesheet" href="/static/sso/css/style.css">
    <style>
        .error-info{
            height: 30px;
            line-height: 30px;
            text-align: left;
            padding-left: 10px;
            color: #ff7567;
        }
        button{
            margin-top: 0;
        }
    </style>

    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

</head>

<body>

<div class="page-container">
    <h1>三月登录系统</h1>
    <form>
        <input type="text" name="username" class="username" placeholder="账号">
        <input type="password" name="password" class="password" placeholder="密码">
        <div class="error-info"></div>
        <button type="button" onclick="login()">登录</button>
    </form>

</div>

<!-- Javascript -->
<script src="/static/sso/js/jquery-1.8.2.min.js"></script>
<script src="/static/sso/js/supersized.3.2.7.min.js"></script>
<script src="/static/sso/js/supersized-init.js"></script>
<script src="/static/sso/js/scripts.js"></script>

<script>
   function login() {
       let username = $('.username').val();
       let password = $('.password').val();
       
       $.post("/api/v1/sso/login", {
           username: username,
           password: password,
       }, function (data) {
           if (data.code < 0){
               $('.error-info').text(data.msg);
               return
           }
           location.reload()
       })
   }
</script>
</body>

</html>
{{ end }}
